﻿using System.Data.SqlClient;

namespace dPet.Infrastructure.EntityFramework.Repositories
{
	using dPet.Domain.Models;
	using dPet.Domain.Repositories;
	using Hangerd.EntityFramework;
	using Hangerd.Repository;

	public class InventoryReducingRecordRepository : EfRepository<InventoryReducingRecord>, IInventoryReducingRecordRepository
	{
		public InventoryReducingRecordRepository(IRepositoryContext unitOfWork)
			: base(unitOfWork)
		{ }

		public void RemoveRecordsByOrder(OrderBase order)
		{
			base.ExecuteCommand("DELETE dbo.InventoryReducingRecord WHERE HospitalId = @hospitalId AND OrderNumber = @orderNumber",
				new SqlParameter("@hospitalId", order.HospitalId),
				new SqlParameter("@orderNumber", order.OrderNumber));
		}
	}
}
